/*
*/

#include "./mainwindow.h"

MainWindow::MainWindow( QWidget *parent ) : QMainWindow( parent )
{
   QCoreApplication::setApplicationName( "The c00l-est texture thingy program ever" );
   
   setupUi( this );
   
   
   renderArea->setAmbientRed( ambientRedSlider->value() );
   renderArea->setAmbientGreen( ambientGreenSlider->value() );
   renderArea->setAmbientBlue( ambientBlueSlider->value() );
   
   renderArea->setLight1Red( light1RedSlider->value() );
   renderArea->setLight1Green( light1GreenSlider->value() );
   renderArea->setLight1Blue( light1BlueSlider->value() );
   
   renderArea->setLight2Red( light2RedSlider->value() );
   renderArea->setLight2Green( light2GreenSlider->value() );
   renderArea->setLight2Blue( light2BlueSlider->value() );
   
   renderArea->setLight3Red( light3RedSlider->value() );
   renderArea->setLight3Green( light3GreenSlider->value() );
   renderArea->setLight3Blue( light3BlueSlider->value() );
   
   renderArea->setLightEnabled( lightGroupBox->isChecked() );
   renderArea->setAmbientLightEnabled( ambientLightGroupBox->isChecked() );
   renderArea->setLight1Enabled( light1GroupBox->isChecked() );
   renderArea->setLight2Enabled( light2GroupBox->isChecked() );
   renderArea->setLight3Enabled( light3GroupBox->isChecked() );
   
   connect( renderArea, SIGNAL(updateFps(int)), this, SLOT(slotUpdateFps(int)) );
   connect( rendererComboBox, SIGNAL(currentIndexChanged(int)), renderArea, SLOT(setRenderer(int)) );
   connect( demoComboBox, SIGNAL(currentIndexChanged(int)), renderArea, SLOT(setDemo(int)) );
   
   connect( lightGroupBox, SIGNAL(toggled(bool)), renderArea, SLOT(setLightEnabled(bool)) );
   connect( ambientLightGroupBox, SIGNAL(toggled(bool)), renderArea, SLOT(setAmbientLightEnabled(bool)) );
   connect( light1GroupBox, SIGNAL(toggled(bool)), renderArea, SLOT(setLight1Enabled(bool)) );
   connect( light2GroupBox, SIGNAL(toggled(bool)), renderArea, SLOT(setLight2Enabled(bool)) );
   connect( light3GroupBox, SIGNAL(toggled(bool)), renderArea, SLOT(setLight3Enabled(bool)) );
   connect( hiddenSurfaceRemovalCheckBox, SIGNAL(toggled(bool)), renderArea, SIGNAL(setHiddenSurfaceRemovalEnabled(bool)) );

   connect( ambientRedSlider, SIGNAL(sliderMoved(int)), renderArea, SLOT(setAmbientRed(int)) );
   connect( ambientGreenSlider, SIGNAL(sliderMoved(int)), renderArea, SLOT(setAmbientGreen(int)) );
   connect( ambientBlueSlider, SIGNAL(sliderMoved(int)), renderArea, SLOT(setAmbientBlue(int)) );
   
   connect( light1RedSlider, SIGNAL(sliderMoved(int)), renderArea, SLOT(setLight1Red(int)) );
   connect( light1GreenSlider, SIGNAL(sliderMoved(int)), renderArea, SLOT(setLight1Green(int)) );
   connect( light1BlueSlider, SIGNAL(sliderMoved(int)), renderArea, SLOT(setLight1Blue(int)) );
   
   connect( light2RedSlider, SIGNAL(sliderMoved(int)), renderArea, SLOT(setLight2Red(int)) );
   connect( light2GreenSlider, SIGNAL(sliderMoved(int)), renderArea, SLOT(setLight2Green(int)) );
   connect( light2BlueSlider, SIGNAL(sliderMoved(int)), renderArea, SLOT(setLight2Blue(int)) );
   
   connect( light3RedSlider, SIGNAL(sliderMoved(int)), renderArea, SLOT(setLight3Red(int)) );
   connect( light3GreenSlider, SIGNAL(sliderMoved(int)), renderArea, SLOT(setLight3Green(int)) );
   connect( light3BlueSlider, SIGNAL(sliderMoved(int)), renderArea, SLOT(setLight3Blue(int)) );
}

void MainWindow::slotUpdateFps(int fps)
{
   FpsLcd->display( fps );
}
